//package com.example.novelstory.config;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import redis.clients.jedis.JedisPool;
//import redis.clients.jedis.JedisPoolConfig;
//
//@Configuration
//public class RedisPoolFactory {
//    @Autowired
//    RedisConfig redisConfig;
//
//    @Bean
//    public JedisPool JedisFactory() {
//        JedisPoolConfig poolConfig = new JedisPoolConfig();
//        poolConfig.setMaxTotal(Integer.valueOf(redisConfig.getPool().get("max-active")));
//        poolConfig.setMaxIdle(Integer.valueOf(redisConfig.getPool().get("max-idle")));
//        poolConfig.setMaxWaitMillis(Integer.valueOf(redisConfig.getPool().get("max-wait")) * 1000);  //注意单位是ms，要转换单位
//        poolConfig.setMinIdle(Integer.valueOf(redisConfig.getPool().get("min-idle")));
//        return new JedisPool(poolConfig, redisConfig.getHost(), redisConfig.getPort(),
//                redisConfig.getTimeout()*1000, null,redisConfig.getDatabase());
//    }
//}
